package com.recruit.server.controller;

import com.recruit.server.common.HeaderInfo;
import com.recruit.server.request.shipping.AddShippingRequest;
import com.recruit.server.request.shipping.ListShippingRequest;
import com.recruit.server.request.shipping.UpdateShippingRequest;
import com.recruit.server.response.shipping.AddShippingResponse;
import com.recruit.server.response.shipping.ListShippingResponse;
import com.recruit.server.response.shipping.UpdateShippingResponse;
import com.recruit.server.service.IShippingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/shipping")
public class ShippingController {

    @Autowired
    private IShippingService iShippingService;

    @PostMapping("/list")
    public ListShippingResponse list(@Validated @RequestBody ListShippingRequest request, HeaderInfo headerInfo) {
        return iShippingService.list(request, headerInfo);
    }

    @PostMapping("/add")
    public AddShippingResponse add(@Validated @RequestBody AddShippingRequest request, HeaderInfo headerInfo) {
        return iShippingService.add(request, headerInfo);
    }

    @PostMapping("/update")
    public UpdateShippingResponse update(@Validated @RequestBody UpdateShippingRequest request, HeaderInfo headerInfo) {
        return iShippingService.update(request, headerInfo);
    }
}
